package ro.cityprojects.adminloc.entities;

import javax.persistence.*;
import java.util.Set;

/**
 * Street class
 *
 * @author bogdan.solga
 * 
 * Date: 13.06.2013, time: 17:47
 */
@Entity
public class Street extends BaseEntity {

    @Id
    @Column(name = "STREET_ID", nullable = false, insertable = true, updatable = true, length = 0)
    private Integer streetId;

    public Integer getStreetId() {
        return streetId;
    }

    public void setStreetId(Integer streetId) {
        this.streetId = streetId;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "CITY_ID", referencedColumnName = "CITY_ID", nullable = false)
    private City cityByCityId;

    public City getCityByCityId() {
        return cityByCityId;
    }

    public void setCityByCityId(City cityByCityId) {
        this.cityByCityId = cityByCityId;
    }

    @Column(name = "CURRENT_NAME", nullable = false, insertable = true, updatable = true, length = 64, precision = 0)
    private String currentName;

    public String getCurrentName() {
        return currentName;
    }

    public void setCurrentName(String currentName) {
        this.currentName = currentName;
    }

    @Column(name = "OLD_NAME", nullable = true, insertable = true, updatable = true, length = 64, precision = 0)
    private String oldName;

    public String getOldName() {
        return oldName;
    }

    public void setOldName(String oldName) {
        this.oldName = oldName;
    }

    @OneToMany(mappedBy = "streetByStreetId")
    private Set<Association> associationsByStreetId;

    public Set<Association> getAssociationsByStreetId() {
        return associationsByStreetId;
    }

    public void setAssociationsByStreetId(Set<Association> associationsByStreetId) {
        this.associationsByStreetId = associationsByStreetId;
    }
}
